import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '#/layouts';
import { $t } from '#/locales';
import {
  DoorClosed,
  LogIn,
  Truck,
  Users,
  ShieldAlert,
  Warehouse,
  MapPin,
  BarChart3,
  Beaker,
  Bell,
  FileText,
  Briefcase,
  UserCheck,
  Car,
  ClipboardCheck,
  ZoomIn,
  AlertTriangle,
  Cog,
  ParkingCircle,
  CalendarCheck,
  ClipboardList,
  Map,
  AlertOctagon,
  LineChart,
  Route,
  AlertCircle,
  UserX,
  Crosshair,
  Eye,
  Home, // 添加 Home 图标
} from 'lucide-vue-next';

const routes: RouteRecordRaw[] = [
  {
    component: BasicLayout,
    meta: {
      icon: 'mdi:city',
      order: 3000,
      title: $t('page.publicEngineering.publicEngineering'),
      authority: ['AC100000', 'AC100001'],
    },
    name: 'PublicEngineerings',
    path: '/public-engineerings',
    children: [
      {
        name: 'PublicEngineering',
        path: 'public-engineering',
        meta: {
          icon: 'mdi:city',
          title: $t('page.publicEngineering.publicEngineering'),
          authority: ['AC100000', 'AC100001'],
        },
        children: [
          {
            name: 'RealTimeMonitoring',
            path: 'real-time-monitoring',
            component: () =>
              import(
                '#/views/agile-emergency/public-engineering/RealTimeMonitoring.vue'
              ),
            meta: {
              // icon: 'mdi:monitor-dashboard',
              title: $t('page.publicEngineering.realTimeMonitoring'),
              authority: ['AC100000', 'AC100001'],
            },
          },
          {
            name: 'EquipmentInfo',
            path: 'equipment-info',
            component: () =>
              import(
                '#/views/agile-emergency/public-engineering/EquipmentInfo.vue'
              ),
            meta: {
              // icon: 'mdi:tools',
              title: $t('page.publicEngineering.equipmentInfo'),
              authority: ['AC100000', 'AC100001'],
            },
          },
          {
            name: 'InstrumentInfo',
            path: 'instrument-info',
            component: () =>
              import(
                '#/views/agile-emergency/public-engineering/InstrumentInfo.vue'
              ),
            meta: {
              // icon: 'mdi:gauge',
              title: $t('page.publicEngineering.instrumentInfo'),
              authority: ['AC100000', 'AC100001'],
            },
          },
          {
            name: 'SummaryStatisticss',
            path: 'summary-statisticss',
            component: () =>
              import(
                '#/views/agile-emergency/public-engineering/SummaryStatistics.vue'
              ),
            meta: {
              // icon: 'mdi:gauge',
              title: $t('page.publicEngineering.summaryStatistics'),
              authority: ['AC100000', 'AC100001'],
            },
          },
          {
            name: 'HisSummary',
            path: 'his-summary',
            component: () =>
              import(
                '#/views/agile-emergency/public-engineering/HisSummary.vue'
              ),
            meta: {
              // icon: 'mdi:gauge',
              title: $t('page.publicEngineering.hisSummary'),
              authority: ['AC100000', 'AC100001'],
            },
          },
          // {
          //   name: 'SummaryStatistics',
          //   path: 'summary-statistics',

          //   meta: {
          //     // icon: 'mdi:chart-bar',
          //     title: $t('能耗在线监测'),
          //   },
          //   children: [

          //   ]
          // },
        ],
      },
    ].filter((route) => {
      if (!route.name) {
        console.error('Route missing name:', route);
        return false;
      }
      return true;
    }),
  },
];

// 添加一个检查函数
function checkRoutes(routes: RouteRecordRaw[]) {
  routes.forEach((route) => {
    if (!route.name) {
      console.error('Route missing name:', route);
    }
    if (route.children) {
      checkRoutes(route.children);
    }
  });
}

checkRoutes(routes);

export default routes;
